if __name__ == "__main__":
    import os
    from parser import Parser

    HOME_DIR = os.environ["HOME"]

    parser = Parser()
    # # reset_password.liquid
    # tree = parser.parse(
    #     open(f"{HOME_DIR}/文档/pyliquid/tests/templates/customers/reset_password.liquid").read()
    # )
    # print(tree)
    # print(tree.pretty())

    # # customers/activate_account.liquid
    # tree = parser.parse(
    #     open(f"{HOME_DIR}/文档/pyliquid/tests/templates/customers/activate_account.liquid").read()
    # )
    # print(tree)
    # # customers/login.liquid
    # tree = parser.parse(
    #     open(f"{HOME_DIR}/文档/pyliquid/tests/templates/customers/login.liquid").read()
    # )
    # print(tree)
    # # customers/order.liquid
    # tree = parser.parse(
    #     open(f"{HOME_DIR}/文档/pyliquid/tests/templates/customers/login.liquid").read()
    # )
    # print(tree)
    # # page.contact.liquid
    # tree = parser.parse(
    #     open(f"{HOME_DIR}/文档/pyliquid/tests/templates/page.contact.liquid").read()
    # )
    # print(tree)
    # # customers/register.liquid
    # tree = parser.parse(
    #     open(f"{HOME_DIR}/文档/pyliquid/tests/templates/customers/register.liquid").read()
    # )
    # print(tree)
    # # customers/addresses.liquid
    # tree = parser.parse(
    #     open(f"{HOME_DIR}/文档/pyliquid/tests/templates/customers/addresses.liquid").read()
    # )
    # print(tree)
    # # product.liquid
    # tree = parser.parse(
    #     open(f"{HOME_DIR}/文档/pyliquid/tests/templates/product.liquid").read()
    # )
    # print(tree)
    # # gift_card.liquid
    # tree = parser.parse(
    #     open(f"{HOME_DIR}/文档/pyliquid/tests/templates/gift_card.liquid").read()
    # )
    # print(tree)

    from liquid import Liquid

    # liquid = Liquid(
    #     template=f"{HOME_DIR}/文档/pyliquid/tests/templates/customers/reset_password.liquid"
    # )

    # print(liquid.render(
    #     context={}
    # ))

    # liquid = Liquid(
    #     template="""
    #     {{ Hello }}
    #     {{ Hello }}
    # """
    # )
    # print(liquid.render(context={
    #     "a": {
    #         "page": {
    #             "name": "Hello, world!"
    #         }
    #     }
    # }))
    template = Liquid(
    """
    {{ "Correct Pages:" | append: "Hello" | append: "world" | prepend: "你错了" }}
    """
    )

    print(
        template.render(
            context={
                "customer": {
                    "order": {
                        "financial_status_label": "Financial Label",
                        "fulfillment_status_label": "Fulfillment Label",
                        "total_price": 1.2
                    },
                    "account": {"name": "name", "details": "Begin"},
                }
            }
        )
    )
